import {request, handleFetchResultNotification, REQUEST_TYPE} from '../../utils';
import {formatMessage} from '../intl';
import stringify from 'Shared/utils/stringify';
const baseUrl = '/afterSales/api/v1';
import {PAGE} from '../../constants';
import {baseDataStatus} from '../../Enum.js';
const pwcDesc = formatMessage({
    id: 'api.message.pwcDesc',
    defaultMessage: '查询备件索赔分类标准'
});
export const getDutyUnitSimple = queryCondition => {
    const queryString = stringify({
        ...queryCondition,
        status: baseDataStatus.生效,
        pageSize: PAGE.smallSize,
        pageIndex: PAGE.index,
    });
    return request(`${baseUrl}/partWarrantyCategories?${queryString}`, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, pwcDesc));
};

export const getDutyUnits = queryCondition => {
    const queryString = stringify({
        ...queryCondition,
        status: baseDataStatus.生效,
    });
    return request(`${baseUrl}/partWarrantyCategories?${queryString}`, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, pwcDesc));
};
